package xzx.controller;

import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import lombok.Data;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Flux;
import xzx.bean.ChatEntity;
import xzx.service.IChatService;

/**
 * @className: ChatController
 * @author: xzx
 * @date: 2025-10-20
 **/
@RestController
@RequestMapping("/chat")
public class ChatController {
    @Resource
    private IChatService chatService;

    @PostMapping("/doChat")
    public void doChat(@RequestBody ChatEntity chatEntity){
        chatService.doChat(chatEntity);
    }

    @GetMapping("/doChat/test1/{message}/{chatId}")
    public Flux<String> doChatTest1(@PathVariable("message")String message,@PathVariable("chatId")Long chatId, HttpServletResponse response){
        response.setCharacterEncoding("UTF-8");
        return chatService.doChatTest1(message,chatId);
    }
}
